<template>
  <div class="page-content">
    <!-- 投喂机器条件筛选 -->
    <table-bar :showTop="false">
      <div slot="top">
        <el-form
          label-width="70px"
          :model="mparams"
          ref="tiaojianRef"
          :rules="paramsRules"
        >
          <el-row :gutter="20">
            <el-col :xs="24" :sm="12" :lg="6">
              <el-form-item label="鸽棚：" prop="dovecoteNumber">
                <el-input placeholder="鸽棚"></el-input>
              </el-form-item>
            </el-col>

            <el-row
              :xs="24"
              :sm="12"
              :lg="6"
              style="float: right; margin-right: 10px;"
            >
              <el-button type="primary">搜索</el-button>
              <el-button>重置</el-button>
            </el-row>
          </el-row>
        </el-form>
      </div>
      <div slot="bottom">
        <el-button type="primary" plain>添加</el-button>
        <el-button type="danger" plain>批量关闭</el-button>
      </div>
    </table-bar>

    <!--投喂机信息表格 -->
    <el-table
      size="mini"
      ref="mmultipleTable"
      :data="machineList"
      tooltip-effect="dark"
      style="width: 100%"
    >
      <el-table-column type="selection" width="55"></el-table-column>
      <el-table-column label="智能灯编号" prop="machineNumber" />
      <el-table-column label="鸽棚" prop="dovecoteNumber" />
      <el-table-column label="光照强度" prop="speed" />
      <el-table-column label="运行转速" prop="rev" />
      <el-table-column label="运行时间" prop="standingTime" />
      <el-table-column label="维护周期(天)" prop="maintenancePeriod" />
      <el-table-column label="状态">
        <template slot-scope="scope">
          <el-switch
            v-model="scope.row.open"
            active-color="#409eff"
            inactive-color="#dcdfe6"
          >
          </el-switch>
        </template>
      </el-table-column>
      <el-table-column label="操作" width="180px">
        <template>
          <el-button type="text" icon="el-icon-edit">编辑</el-button>
          <el-button type="text" style="color:#f56c6c;" icon="el-icon-delete"
            >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页区域 -->
    <el-pagination
      @size-change="mSizeChange"
      @current-change="mCurrentChange"
      :current-page="mqueryinfo.mpagenum"
      :page-sizes="[5, 10, 15, 20]"
      :page-size="mqueryinfo.mpagesize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total"
    >
    </el-pagination>
  </div>
</template>

<script>
export default {
  name: "LightManage",
  meta: {
    title: "智能亮灯"
  },
  data() {
    return {
      // 鸽棚下拉框
      doptions: [],
      baseid: 0,
      activeName: "first",
      dvEdit: false,
      dialogTitle: "",
      form: {
        username: "",
        mibile: "",
        email: "",
        sex: 1,
        dep: "",
        status: true,
        userList1: []
      },
      options: [
        {
          value: "1",
          label: "A01"
        },
        {
          value: "2",
          label: "A02"
        }
      ],
      value: "",
      userList: [],
      userInfo: {
        operator: "",
        dovecoteNumber: "",
        clearTime: "",
        weight: 0,
        type: "",
        machineNumber: ""
      },
      addInfo: {
        operator: "",
        dovecoteNumber: "",
        clearTime: "",
        weight: 0,
        type: "",
        machineNumber: ""
      },
      queryinfo: {
        // 自带参数，用于搜索
        pagenum: 1,
        pagesize: 10
      },
      total: 6,
      drinkingdialog: false,
      adddrinkingdialog: false,
      timedialogVisible: false,
      params: {
        operator: "",
        dovecoteNumber: "",
        startTime: "",
        endTime: ""
      },
      idList: [],
      // 添加操作人跟鸽棚都是字符串的格式规则

      // 机器
      machineList: [
        {
          dovecoteNumber: "A01",
          id: "1463101117273542657",
          machineNumber: "M4",
          maintenancePeriod: "15天",
          open: true,
          rev: "183Lx",
          speed: "23m/s",
          standingTime: "10天",
          startTime: "2021-11-26 21:30:14",
          stopTime: "2021-11-26 21:30:41",
          type: "kg"
        },
        {
          dovecoteNumber: "A01",
          id: "1463101117273542657",
          machineNumber: "U4",
          maintenancePeriod: "15天",
          open: true,
          rev: "183Lx",
          speed: "23m/s",
          standingTime: "12天",
          startTime: "2021-11-26 21:30:14",
          stopTime: "2021-11-26 21:30:41",
          type: "kg"
        },
        {
          dovecoteNumber: "A01",
          id: "1463101117273542657",
          machineNumber: "S5",
          maintenancePeriod: "15天",
          open: true,
          rev: "183Lx",
          speed: "23m/s",
          standingTime: "23天",
          startTime: "2021-11-26 21:30:14",
          stopTime: "2021-11-26 21:30:41",
          type: "kg"
        },
        {
          dovecoteNumber: "A01",
          id: "1463101117273542657",
          machineNumber: "A8",
          maintenancePeriod: "15天",
          open: true,
          rev: "183Lx",
          speed: "23m/s",
          standingTime: "23天",
          startTime: "2021-11-26 21:30:14",
          stopTime: "2021-11-26 21:30:41",
          type: "kg"
        },
        {
          dovecoteNumber: "A01",
          id: "1463101117273542657",
          machineNumber: "K0",
          maintenancePeriod: "15天",
          open: true,
          rev: "183Lx",
          speed: "23m/s",
          standingTime: "23天",
          startTime: "2021-11-26 21:30:14",
          stopTime: "2021-11-26 21:30:41",
          type: "kg"
        },
        {
          dovecoteNumber: "A01",
          id: "1463101117273542657",
          machineNumber: "C5",
          maintenancePeriod: "15天",
          open: false,
          rev: "183Lx",
          speed: "23m/s",
          standingTime: "63天",
          startTime: "2021-11-26 21:30:14",
          stopTime: "2021-11-26 21:30:41",
          type: "kg"
        }
      ],
      mqueryinfo: {
        // 自带参数，用于搜索
        mpagenum: 1,
        mpagesize: 10
      },
      mtotal: 0,
      mparams: {
        dovecoteNumber: "",
        open: ""
      },
      maddfeeddialog: false,
      mparamsRules: {
        dovecoteNumber: [{ message: "请输入鸽棚编号", trigger: "blur" }],
        open: [{ message: "请选择开关状态", trigger: "blur" }]
      },
      machineInfo: {
        machineNumber: "",
        dovecoteNumber: "",
        rev: "",
        speed: "",
        direction: 0,
        maintenancePeriod: 0,
        startTime: "",
        stopTime: "",
        standingTime: 0
      },
      meditfeeddialog: false,
      maddInfo: {
        machineNumber: "",
        dovecoteNumber: "",
        rev: "",
        speed: "",
        direction: 0,
        maintenancePeriod: 0,
        startTime: "",
        stopTime: "",
        standingTime: 0
      },
      isopen: false,
      midList: [],
      closeInfo: {
        operator: "",
        weight: "",
        type: "",
        machineNumber: ""
      }
    };
  }
};
</script>
<style>
.el-table td,
.el-table th {
  text-align: center;
}
.el-tabs--top .el-tabs__item.is-top:nth-child(2) {
  padding-left: 16px;
}
</style>
<style lang="scss" scoped>
.table-bar {
  margin-top: 20px;
}
.page-content {
  width: 100%;
  height: 100%;

  .avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
  }
  .page {
    margin-top: 6px;
    text-align: center;
  }
}
/deep/.el-pagination {
  margin-top: 5px;
  /* margin: 5px auto; */
  text-align: center;
}
</style>
